<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <!--head_include-->
    <div th:fragment="head_include">

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="description" content="">
        <meta name="author" content="">
        <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700" rel="stylesheet">

        <title>RMMS</title>

        <!-- Bootstrap core CSS -->
        <link th:href="@{/vendor/bootstrap/css/bootstrap.min.css}" rel="stylesheet">

        <!-- Additional CSS Files -->
        <link rel="stylesheet" th:href="@{/assets/css/fontawesome.css}">
        <link rel="stylesheet" th:href="@{/assets/css/templatemo-style.css}">
        <link rel="stylesheet" th:href="@{/assets/css/owl.css}">

    </div>
</head>
<body>

<div th:fragment="page_info">
    <div id="pageInfo">
        共[[${page.total}]]条,
        <span th:if="${ ( page.pageNum - 1 ) * page.pageSize + 1 == page.total }">
			当前显示第[[${page.total}]]条,
	</span>
        <span th:if="${ ( page.pageNum - 1 ) * page.pageSize + 1 != page.total }">
			当前显示[[${page.startRow}]]-[[${page.endRow}]]条,
	</span>
        第[[${page.pageNum}]]/[[${page.pages}]]页
        |
        <a href="#" th:if="${page.pageNum > 1}"><span class="linkspan" id="one">首页</span>&nbsp;</a>
        <a href="#" th:if="${page.pageNum > 1}"><span class="linkspan" id="two">上一页</span>&nbsp;</a>
        <a href="#" th:if="${page.pageNum < page.pages}"><span class="linkspan"
                                                               id="three">下一页</span>&nbsp;</a>
        <a href="#" th:if="${page.pageNum != page.pages}"><span class="linkspan" id="four">末页</span>&nbsp;</a>
        |
        到<input type="text" id="pageNo" size=4 style="text-align:right;"
                onkeypress="onlynumber();"/> 页
        <button class="linkspan" id="five" style="color:black;text-decoration:none;"> 跳 转</button>
    </div>
    <script type="text/javascript" th:src="@{/js/jquery-3.1.1.min.js}"></script>
    <script th:inline="javascript">

        $(function () {
            //删除操作
            $(".delete").click(function () {
                var href = $(this).attr("href");
                if (confirm("确定要删除吗?")) {
                    $("form:eq(0)").attr("action", href).submit();
                    return false;
                }
            });

            $(".update").click(function () {
                var href = $(this).attr("href");
                $(location).attr("href", href);
            });

            $(".info").click(function () {
                var href = $(this).attr("href");
                $(location).attr("href", href);

            });

            //分页操作
            $(".linkspan").click(function () {

                var pageNo = [[${page.pageNum}]];
                var totalPageNum = [[${page.pages}]];
                var re = /^[0-9]+.?[0-9]*$/;

                if (String($(this).attr("id")) == String("one"))
                    pageNo = 1;

                if (String($(this).attr("id")) == String("two"))
                    pageNo = pageNo - 1;

                if (String($(this).attr("id")) == String("three"))
                    pageNo = pageNo + 1;

                if (String($(this).attr("id")) == String("four"))
                    pageNo = totalPageNum;

                if (String($(this).attr("id")) == String("five")) {
                    var num = $.trim($("#pageNo").val());

                    if (!re.test(num)) {
                        alert("输入的不是数字!");
                        return;
                    }
                    pageNo = parseInt(num);
                    if (pageNo < 1 || pageNo > totalPageNum) {
                        alert("页号超出范围，有效范围：[1-" + totalPageNum + "]!");
                        return;
                    }

                }

                var href = "?pageNo=" + pageNo;
                $(location).attr("href", href);
                return false;

            });
        });

    </script>
</div>

<!-- Sidebar -->
<div id="sidebar" th:fragment="sidebar">
    <div class="inner">

        <!-- Search Box -->
        <section id="search" class="alt">
            <form method="get" action="#">
                <input type="text" name="search" id="search" placeholder="Search..."/>
            </form>
        </section>

        <!-- Menu -->
        <nav id="menu">
            <ul>
                <li><a th:href="@{/security/mainController}">主页</a></li>
                <!--用户-->
                <li>
                    <span class="opener">用户</span>
                    <ul>
                        <li><a th:href="@{/user/toInput}">新增用户 #1</a></li>
                        <li><a th:href="@{/user/list}">用户管理 #2</a></li>
                    </ul>
                </li>
                <!--道路-->
                <li>
                    <span class="opener">道路</span>
                    <ul>
                        <li><a th:href="@{/road/toInput}">新增道路 #1</a></li>
                        <li><a th:href="@{/road/list}">道路管理 #2</a></li>
                    </ul>
                </li>
                <!--日常巡查-->
                <li>
                    <span class="opener">日常巡查</span>
                    <ul>
                        <li><a th:href="@{/dailyInspect/toInput}">新增日常巡查 #1</a></li>
                        <li><a th:href="@{/dailyInspect/list}">日常巡查管理 #2</a></li>
                    </ul>
                </li>
                <!--定期巡查-->
                <li>
                    <span class="opener">定期巡查</span>
                    <ul>
                        <li><a th:href="@{/regularSmooth/toInput}">新增定期平整巡查 #1</a></li>
                        <li><a th:href="@{/regularSmooth/list}">定期平整巡查管理 #2</a></li>
                        <li><a th:href="@{/regularDamage/toInput}">新增定期损坏巡查 #3</a></li>
                        <li><a th:href="@{/regularDamage/list}">定期损坏巡查管理 #4</a></li>
                    </ul>
                </li>
                <!--技术状况评价-->
                <li><a th:href="@{/regularDamage/listEval}">技术状况评价</a></li>
                <li><a href="#">External Link</a></li>
            </ul>
        </nav>

        <!-- Footer -->
        <footer id="footer">
            <p class="copyright">Copyright &copy; 2019 Company Name
                <br>Designed by CQJTU <a href="http://www.cqjtu.edu.cn/" target="_blank"
                                         title="重庆交通大学">重庆交通大学</a></p>
        </footer>

    </div>
</div>

<!--tail_include-->
<div th:fragment="tail_include">
    <!-- Scripts -->
    <!-- Bootstrap core JavaScript -->
    <script th:src="@{/vendor/jquery/jquery.min.js}"></script>
    <script th:src="@{/vendor/bootstrap/js/bootstrap.bundle.min.js}"></script>

    <script th:src="@{/assets/js/browser.min.js}"></script>
    <script th:src="@{/assets/js/breakpoints.min.js}"></script>
    <script th:src="@{/assets/js/transition.js}"></script>
    <script th:src="@{/assets/js/owl-carousel.js}"></script>
    <script th:src="@{/assets/js/custom.js}"></script>
</div>
</body>
</html>